<?php

// 查看传过来的参数  get请求
//var_dump($_GET["uid"]);

// 获取用户id
$uid = !isset($_GET["uid"])?die("缺少关键参数"):trim($_GET["uid"]);

/*
 * 根据uid查询用户信息
 */
$db = mysqli_connect("localhost","root","123456","bbs");
$sql = "select * from userinfo where uid=?";
$pr = $db->prepare($sql);
$pr->bind_param("i",$uid);
$pr->bind_result($uid,$userName,$userPwd,$note,$profile,$isadmin);
$pr->execute();
$pr->fetch();
//echo $uid,$userName,$userPwd,$note,$profile,$isadmin;

session_start();
?>

<style>
    .img{
        width: 150px;
        height: 150px;
        border-radius: 100px;
    }
</style>

<div>
    <?php
        if($_SESSION['userinfo']["isadmin"]==1){
            echo "<a href='admin.php' > 类型管理页面</a>";
        }

    ?>
</div>
<form action="updatauserinfo.php" method="post" enctype="multipart/form-data">
    <label>
        用户名：
        <input name="userName" disabled value="<?php echo $userName ?>">
    </label> <br>
    <label>
        密 &nbsp; 码：
        <input name="userPwd" type="password" value="<?php echo $userPwd ?>">
    </label> <br>
    <label>
        头&emsp;像：
        <input class="img" type="image" src="<?php echo $profile ?>">
        <input name="profile" type="file">
    </label> <br>
    <label>
        简&emsp;介：
        <textarea name="note"><?php echo $note ?></textarea>
    </label> <br>
    <input type="reset"> <input type="submit" value="注册信息">
    <button type="button" onclick="window.location.href='index.php'" >返回</button>
    <input type="hidden" name="uid" value="<?php echo $uid ?>">
    <input type="hidden" name="oldProfile" value="<?php echo $profile ?>">
</form>


